<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>axois学习</title>
    <script src="js/axios-0.18.0.js"></script>
</head>

<body>
    <div id="div1">
        axois学习
    </div>
    <input type="button" value="get" onclick="get2()">
    <input type="button" value="post" onclick="post()">
</body>

<script>
    function get() {
        axios({
            method: "GET",
            url: "https://jsonplaceholder.typicode.com/todos/1"
        }).then((res)=>{
            console.log(res.data)
        })
    }

    function post() {
        axios({
            method: "POST",
            url: "https://jsonplaceholder.typicode.com/posts"
        }).then((res)=>{
            console.log(res.data)
        })
    }
    
    function get2() {
        axios.get("https://jsonplaceholder.typicode.com/todos/1").then((res)=>{
            console.log(res.data)
        })
    }
    
    function post2() {
        axios.post("https://jsonplaceholder.typicode.com/todos/1").then((res)=>{
            console.log(res.data)
        })
    }
    
</script>

</html>